<template>
  <div>
      <ul>
          <li v-for="(item, ind) in arr"
          :key="item">
              <span>{{ item }}</span>
              <button @click="shan(ind)">删除</button>
          </li>
      </ul>
      <button @click="add">生成</button>
  </div>
</template>

<script>
export default {
data(){
    return {
        arr:[]
    }
},
methods: {
    add(){
        this.arr.push(Math.floor(Math.random()*50))
    },shan(i){
this.arr.splice(i,1)
    }
}
}
</script>

<style>

</style>